
const config = require('../../../config/api.js');
Page({


  data: {
    taskDetails: [],
    receiveStatus: false,
    sta:false
  },

  onLoad: function(options) {
    let taskDetailsUrl = config.taskDetailsUrl;
    wx.request({
      url: 'https://api.mokyun.com/express/task/detail',
      method: 'POST',
      data: {
        task_id: options.taskid
      },
      header: {
        'Authorization': 'Bearer ' + wx.getStorageSync('token')
      },
      success: result => {
        console.log(result)
        this.setData({
          taskDetails: result.data
        })
      }
    })
  },

  // receiveTask: function() {
  //   let that = this;
  //   let certStatus = that.data.certStatus;
  //   if (certStatus != 2) {
  //     wx.showModal({
  //       title: '审核状态',
  //       content: '抱歉，您未审核或审核未通过',
  //       confirmText: '前往认证',
  //       success: (res) => {
  //         if (res.confirm) {
  //           wx.navigateTo({
  //             url: '/pages/certification/certification',
  //           })
  //         }
  //       }
  //     })
  //   } else {
  //     this.setData({
  //       sta:true
  //     })
  //   }
  // },
 
  onShow: function() {
    let that = this;
    wx.request({
      url: config.userInfo,
      method: 'POST',
      header: {
        'Authorization': 'Bearer ' + wx.getStorageSync('token')
      },
      success: (res) => {
        that.setData({
          certStatus: res.data.status
        })
      }
    })
  },

})